﻿using SiyinPractice.Framework.Uow;
using System.Threading.Tasks;

namespace SiyinPractice.Infrastructure.EntityFramework.Uow
{
    public class MySqlUnitOfWorkManager : IMySqlUnitOfWorkManager
    {
        private readonly IMySqlUnitOfWork unitOfWork;

        public MySqlUnitOfWorkManager(IMySqlUnitOfWork unitOfWork)
        {
            this.unitOfWork = unitOfWork;
        }

        public IMySqlUnitOfWorkCompleteHandle Begin()
        {
            unitOfWork.Begin();
            return unitOfWork;
        }

        public async Task<IMySqlUnitOfWorkCompleteHandle> BeginAsyc()
        {
            await unitOfWork.BeginAsync();
            return unitOfWork;
        }
    }
}